package com.coder.algorithm.sort;

import java.util.Arrays;

/**
 * 排序测试
 *
 * @author yuhushuan
 * @date 2020/6/6 22:15
 */
public class SortTest {
    public static void main(String[] args) {
        Sort sort = new MergeSort();

//        print(sort, new int[]{1, 2, 3, 4, 5, 6, 7, 8});
//
//        print(sort, new int[]{5, 4, 6, 9, 7, 1, 3, 5});
//
        print(sort, new int[]{9, 8, 7, 6, 5, 4, 3, 2, 1});

        print(sort, new int[]{8, 7, 6, 5, 4, 3, 2, 1});
        print(sort, new int[]{7, 6, 5, 4, 3, 2, 1});
        print(sort, new int[]{6, 5, 4, 3, 2, 1});
        print(sort, new int[]{5, 4, 3, 2, 1});
        print(sort, new int[]{4, 3, 2, 1});
        print(sort, new int[]{3, 2, 1});
        print(sort, new int[]{2, 1});

    }

    private static void print(Sort sort, int[] array) {
        System.out.println("初始值：" + Arrays.toString(array));
        sort.sort(array);
        System.out.println("排序后：" + Arrays.toString(array));
        System.out.println();
    }
}
